package com.example.virgaonline;

import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.text.SpannableString;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class StartMenu extends Activity implements OnClickListener {

	public static boolean isSettingChanged = false;
	
	@Override
	protected void onDestroy(){
			super.onDestroy();
	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_start_menu);
		
		TextView start = (TextView) findViewById(R.id.start);
		TextView lobby = (TextView) findViewById(R.id.lobby);
		TextView settings = (TextView) findViewById(R.id.settings);
		TextView about = (TextView) findViewById(R.id.about);
		TextView exit = (TextView) findViewById(R.id.exit);
		
		start.setOnTouchListener(new MenuTouchListener());
		lobby.setOnTouchListener(new MenuTouchListener());
		settings.setOnTouchListener(new MenuTouchListener());
		about.setOnTouchListener(new MenuTouchListener());
		exit.setOnTouchListener(new MenuTouchListener());
		
		start.setOnClickListener(this);
		lobby.setOnClickListener(this);
		settings.setOnClickListener(this);
		about.setOnClickListener(this);
		exit.setOnClickListener(this);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_start_menu, menu);
		return true;
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()){
		case R.id.start:
			Intent gotoLevelOne = new Intent(this, LevelOneActivity.class);
			startActivity(gotoLevelOne);
			finish();
			break;
		case R.id.lobby:
			Intent gotoLobby = new Intent(this, Lobby.class);
			startActivity(gotoLobby);
			finish();
			break;
		case R.id.settings:
			Intent gotoSettings = new Intent(this, Settings.class);
			startActivity(gotoSettings);
			finish();
			break;
		case R.id.about:
			showAboutInfo();
			break;
		case R.id.exit:
			finish();
			break;
		}
	}
	
	private void showAboutInfo(){
		final SpannableString string_about = new SpannableString("Developed by Zachary Cabot, Aldo Gomez, and Sheel Kumar. \n \n Real Eyes Realize Real Lies \n \n 2012");
		AlertDialog.Builder aboutDialog = new AlertDialog.Builder(this);
		aboutDialog.setMessage(string_about);
		aboutDialog.setPositiveButton("Return", new DialogInterface.OnClickListener(){
			@Override
			public void onClick(DialogInterface dInterface, int a){
				
			}
		});
		AlertDialog createAbout = aboutDialog.create();
		createAbout.show();
	}
	
	public static void areSettingsChanged(){
		isSettingChanged = true;
	}

}
